<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>修改自定义项类型</title>
	<%@ include file="/common/common_style_script.jsp"%>
</head>
<body>
    <form id="formEdit" class="cf wd5 fl">
    	<input id="itemTypeId" name="customItemType.itemTypeId" type="hidden" value="<c:out value="${customItemType.itemTypeId}"/>"/>
        <div>
            <label for="itemTypeName">自定义项类型名称</label>
            <input id="itemTypeName" name="customItemType.itemTypeName" value="<c:out value="${customItemType.itemTypeName}"/>"/>
        </div>
        <div>
        	<label for="itemTypeDesc">自定义项类型描述</label>
        	<input id="itemTypeDesc" name="customItemType.itemTypeDesc" value="<c:out value="${customItemType.itemTypeDesc}"/>"/>
        </div>
        <div class="btn">
            <input id="btnSave" type="button" value="保存"/>
            <input id="btnCancel" type="button" value="取消"/>
        </div>
    </form>
</body>
<script>
$(function(){
	$("#btnSave").click(function(){
		var destUrl = '<c:url value="/ajax/ci/doUpdateType.action"/>';
		var data = {
			"customItemType.itemTypeId":$('#itemTypeId').val(),
			"customItemType.itemTypeName":$('#itemTypeName').val(),
			"customItemType.itemTypeDesc":$('#itemTypeDesc').val(),
		};
		ajaxPost(destUrl, data, function(json){
			var result = eval('('+ json +')');
			if(result.success) {
				alert('操作成功');
				opener.location.reload();
				opener.parent.frames['main'].location.reload();
				self.close();
			} else if(result.exception) {
				alert('操作失败，原因：' + result.exception);
				self.close();
			}
		}, function(request, json, errorThrown){
			alert('连接或请求异常' + json);
			alert(errorThrown);
		});
	});
	$("#btnCancel").click(function(){
		self.close();
	});
});
</script>
</html>